-
Notifications
You must be signed in to change notification settings - Fork 60
Support decryption with hidden recipients. #1275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for reporting, we'll add corresponding functionality once get to this issue. |
I'd be interested to look into this. |
@andrey-utkin Feel free to take it! |
Sorry for the slow start. Test so far:
I will proceed by investigating it and in parallel fitting the test into some existing test suite. |
I'd prefer to have FFI API test as well, since people who use library (like Thunderbird) could use approach which differs from a CLI one. Also it would be good to have test for different cases, like alread-preloaded secret keys, keys loaded by demand via key provider, trying multiple secret keys and so on. |
I got it working with the clumsiest hack ever. Cleaning up and refactoring now, will submit into a branch later.
on_recipients() gets zeros-filled entries. Making it see the effective secret keys would take some extra care, but it's unclear whether anybody really needs that extra complexity. My judgement is that optimal behaviour is
|
@andrey-utkin Good news! Agree with your approach: |
This is my branch so far: https://github.com/andrey-utkin/rnp/tree/autkin-1275-decrypt-hidden-to |
@andrey-utkin Great! Could you please create a draft PR from your branch? It would be easier to discuss changes there (and would run CI including linters and so on)? |
Created a draft PR as requested: #1792 |
To decrypt messages with hidden recipients (per rnpgp#1275) we need to attempt decrypting with every available private key capable of encryption. Attempts with non-corresponding keys will obviously fail, but that is not a failure from user's sperspective, so there should not be log messages about decryption failures. This requirement has been partially satisfied by passing a `bool speculative` parameter. However it doesn't seem appropriate to pass it across the boundary of pluggable crypto backend. And then there's currently no other context passed across that boundary - neither rnp_ffi_t nor SecurityContext. This commit simply drops one message statement from OpenSSL crypto backend to avoid a larger structural rework.
RNP reports that it cannot decrypt if no Key ID of the Public-Key Encrypted Session Key Packets matches a known private key.
It would be great if it instead could check for "hidden" recipients. In case the Key ID
0x00000000
is present, RNP should try to decrypt with all known private keys. See https://tools.ietf.org/html/rfc4880#section-5.1 (last paragraph of that section).Background: Currently Thunderbird 78 an later fails to decrypt messages where the user is a hidden recipient. Such ciphertexts could e.g. be created by Enigmail, or in general with GnuPG's
hidden-encrypt-to
config option. Downstream issue: https://thunderbird.topicbox.com/groups/e2ee/T7e31aaa38399d4b3-Mefc2734288f0dfa17d01b823/fails-to-decrypt-with-recipient-key-id-0x00000000-hidden-recipient.The text was updated successfully, but these errors were encountered: